/**
 * 
 */
package com.wskj.library.book.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wskj.library.service.BookService;
import com.wskj.library.service.impl.BookServiceImpl;
import com.wskj.util.StringUtil;

/**
 * @author 胡洋
 * @describe  根据图书的编号删除图书
 * @Date 2018年3月22日下午6:08:54
 * @version 1.0
 */
@WebServlet(urlPatterns="/book/delete.do")
public class DeleteBookServlet extends HttpServlet {
	//图书的服务类......
	private BookService bookService=new BookServiceImpl();
	
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		  int id=StringUtil.nullToInt(req.getParameter("id"));		
          boolean result=bookService.deleteBookById(id);
          resp.sendRedirect(req.getContextPath()+"/book/list.do");		
	}
	
	

}
